<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
    <head> 
    <meta charset="UTF-8">
    <%@ include file="/WEB-INF/views/include/head.jsp"%>
    <link rel="stylesheet" href="${ctxStatic}/css/common_erp.css">
    <link rel="stylesheet" href="${ctxStatic}/css/layerSm.css">
    <script src="${ctxStatic}/js/jquery-1.9.1.min.js"></script>
    <script src="${ctxStatic}/js/layer.js"></script>
    <script src="${ctxStatic}/js/style.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
    	$("#unitCostNo").select2();
    	if ($("#id").val() == null||$("#id").val() == "") {
    		$("#selMatBtn").hide();
		}
    	onClickTd();
        $(".tabBox ul li").each(function(){
            var index=$(this).index();

            $(".tabBox ul li").eq(0).addClass("active");

            $(this).click(function(){

                $(this).addClass("active").siblings().removeClass("active");

                $(".tabBoxSm > .tabSm").eq(index).stop(true).show().siblings().stop(true).hide();
				
				var tableW = $(".tabBoxSm > .tabSm").eq(index).find('.tableHead').width();
				var tabodyH = $(".tabBoxSm > .tabSm").eq(index).find('.tableBody').height();
				var tableScrollH = $(".tabBoxSm > .tabSm").eq(index).find('.tableScroll').height();
				if(tabodyH>tableScrollH){
					$(".tabBoxSm > .tabSm").eq(index).find('.tableScroll').css('width',tableW + 18 + 'px')
				}else{
					$(".tabBoxSm > .tabSm").eq(index).find('.tableScroll').css('width','inherit')
				}

            })

        })
        
        // 画面制御
        if($("#reserveMeterialStatus").val()=='AUDIT_STATUS-AUDIT_20'){  //审核通过
        	$("#confirmBtn").hide();      	
        }
    });
    
    // 合同订单选择回调
    function selectIndentCallBack(indentId){
		var param = {
				"indentId" : indentId
			};
        // 调用后台更新数据
        $.post("${ctx}/customization/nuclearmaterial/form",param,function(result) {
            // 回调函数赋值
            var h = $(callBackHtml(result)).find("#orderMaterierInfo").html();
            $('#orderMaterierInfo').html(h);
            $("#unitCostNo").select2();
            unitCostFun('unitCostId');
            onClickTd();
        }, 'html');
    }
       
    // 大货单耗联动
    function unitCostFun(id){
     	var datavalue = $("#unitCostNo").find("option:selected").attr("data-value");
        // 设定单耗id
    	$("#"+id).val(datavalue);

     	var sid = $("#styleId").val();
     	var sQuantity = $("#indentQuantity").val().replace(/[^\d\.-]/g, "");
		var param = {
				"styleId" : sid,
				"unitCostId" : datavalue,
				"indentQuantity" : sQuantity,
			};
        // 调用后台更新数据
        $.post("${ctx}/customization/nuclearmaterial/selectUnit",param,function(result) {
            // 回调函数赋值
            var h = $(callBackHtml(result)).find("#tableOrderMateriel").html();
            $('#tableOrderMateriel').html(h);
            
            // 获取物料数
            var mCount = $(callBackHtml(result)).find("#divMaterialNum").html();
            $('#divMaterialNum').html(mCount);
            
            // 获取单耗成本
            var mCost = $(callBackHtml(result)).find("#divUnitCost").html();
            var indentQuantity = $("#indentQuantity").val();
            var trLength = $("#tableOrderMateriel").find(".sub-quantity").length;
            for (var i = 0; i < trLength; i++) {
            	$("#tableOrderMateriel").find(".sub-quantity")[i].innerHTML = indentQuantity;
            	$("#tableOrderMateriel").find(".hiddenIndentQuantity")[i].value = indentQuantity
			}
            $('#divUnitCost').html(mCost);
            $("#selMatBtn").show();
            onClickTd();
            $("#unitCostNo").select2();
        }, 'html');
   }
       
    //保存方法
    var saveForm={
         t:null,
         save:function(t){
              $(t).attr("disabled",true);
              this.t=t;
              // 表单验证
              $("#inputForm").validate({
                   // 重名验证
                   rules: {
                	indentNo: {remote: "${ctx}/customization/nuclearmaterial/checkOrderMaterial?indentId=" +$("#indentId").val()+"&id=" +$("#id").val() }
                   },
                   messages: {
                    //数据值以存在
                    indentNo: {remote: '<spring:message code="orderMateriel_create_ordermaterial_err_msg"/>' }
                   },
                   fail: function(element,e) {  
                        $(saveForm.t).attr("disabled",false);
                   },
                   submitHandler: function() {
                	//设置下标 
                	   setIndex();
                	// 格式化，去除逗号
                       formUnFormat($("#inputForm"));
                	    var params = $("#inputForm").serialize();
                       $.post("${ctx}/customization/nuclearmaterial/save",params,function(result){
                      	 // 提示信息
                           tipParent(result.message);
                           // 返回状态
                           if(result.statusCode==STATUSCODEOK){
                                window.parent.frames[0].searchListForm();
                                closeWin(); 
                           }else{
                                $(saveForm.t).attr("disabled",false);
                           }
                       },'json');
                   }
              });
              // 提交表单
              $("#inputForm").submit(); 
         } 
    }
 // 面料画面迁移
    function selectMhangeMaterialLis() {
        // 客户取得
       var ognizationName = $("#ognizationName").val();
		var url = "&materialTypeCd=MATERIAL_CATEGORY-Fabric_10&ognizationName="+ognizationName;
        popup('1230px','680px','${ctx}/common/material/list?frameFlg=0'+url);
    }
    
 // 删除行
	function removeFun(obj) {
	 	/* if (confirm("确定删除吗？")) { */
			$(obj).parent().remove();
		/* } */
	}
 
	// 面辅配料画面回调方法
	function selectMaterialCallBack(indexList,itemObj) {
        var trTemp;
        var tempDataCells="";
        var tbodyTemp=$("#changeMaterialBody");
		var itemLen = indexList.split(",").length;
		var hiddenTemp="";
		   $(itemObj).each(function(j,item){
                for (var i = 0; i < itemLen; i++) {
					if (indexList.split(",")[i] == j) {

						trTemp=$("#hiddenTable").find(".parentTr").clone();
						tempDataCells=$(trTemp)[0].cells;
						if (itemObj[j].fileName=="") {
                            tempDataCells[1].innerHTML="<img src='${ctxStatic}/images/pic-none.jpg' class='wltp'>";
						} else {
                            tempDataCells[1].innerHTML="<img src='"+itemObj[j].fileName+"' class='wltp'>";
						}
						tempDataCells[2].innerHTML = item.materialCode+"<br>"+item.materialNameCn;
						tempDataCells[3].innerHTML = item.materialTypeCn;
						tempDataCells[4].innerHTML = item.materialColor;
						tempDataCells[5].innerHTML = item.materialSpec;
						tempDataCells[6].innerHTML = item.materialSpecUnitCd;
						tempDataCells[13].innerHTML = "<p class='linkBox' onclick='popupDetailWin(this," + item.materialId + ");'><spring:message code='orderMateriel_show_material_MaterielDetailNone' /></p>";
						tempDataCells[14].innerHTML = item.materialCode;
						tempDataCells[15].innerHTML = item.materialNameCn;
						tempDataCells[16].innerHTML = item.materialComposition;
						tempDataCells[17].innerHTML = item.materialQuantity;
						$(tempDataCells[18]).find(".hiddenMaterialId")[0].value = item.materialId;
						trTemp.appendTo(tbodyTemp);
					}
                }
            });
		   onClickTdYY();
	}
	Math.formatFloat = function(f, digit) { 
		var s = f;
		//判断字符串是否为数字     //判断正整数 /^[1-9]+[0-9]*]*$/  
		var numberVerification = /^[0-9]+.?[0-9]*$/;   
		if (numberVerification.test(s)){
			s = parseFloat((s + "").replace(/[^\d\.-]/g, "")).toFixed(digit) + "";  
		} else {
			s = 0;
		}
	    return parseFloat(s); 
	}
	<!-- 修改 单耗、损耗和服装数量 会触发计算功能，计算结果会覆盖对应的 含损耗单耗 和 预订耗料数 的数据。-->
	<!--  修改 含损耗单耗 和 预订耗料数 不会对其他数据有影响。-->
	function onClickTd() {
		$("#hiddenTable").find("td[class^='sub-']").unbind("click"); 
	    $("#tableOrderMateriel").find("td[class^='sub-']").on("click",function(){
	    	 //找到当前鼠标单击的td
	        var tdObj = $(this);
	        //保存原来的文本  
	        var oldText = $(this).text();
	        //创建一个文本框
	        var index = $(this).parent().index();
            var cellIndex = $(this)[0].cellIndex;
	        var inputTemp = "";
	        if (cellIndex==4){
	        	inputTemp = "<input type='text' value = '"+$(this).text()+"' maxlength = '6'>";
	        } else {
	        	inputTemp = "<input type='text' value = '"+$(this).text()+"' maxlength = '12'>";
	        }
	        var inputObj = $(inputTemp);
	        
	        //去掉文本框的边框  
	        inputObj.css("border-width", 0);
	        inputObj.click(function () {
	            return false;
	        });
	        //使文本框的宽度和td的宽度相同  
	        inputObj.width(tdObj.width()-4);
	        inputObj.height(tdObj.height()-15);
	        //去掉文本框的外边距 
	        inputObj.css("margin", 0);
	        inputObj.css("padding", 0);
	        //把文本框放到td中  
	        tdObj.html(inputObj);
	        //文本框失去焦点的时候变为文本  
	        inputObj.blur(function () {
		           var strRegex = /^(-?\d+)(\.\d+)?$/;
		           if (!strRegex.test($(this).val())){
		        	   $(this).val('0')
		           }
	            var newText = $(this).val();
	            tdObj.html(newText);
	            <!-- 单价 -->
	            var materialCost = $("#tableOrderMateriel tr.parentTr").eq(index).find(".sub-materialCost").text();
	            $("#tableOrderMateriel tr.parentTr").eq(index).find(".hiddenMaterialCost")[0].value = materialCost;
	            <!-- 损耗 -->
	            var materialPreLoss = $("#tableOrderMateriel tr.parentTr").eq(index).find(".sub-materialPreLoss").text();
	            $("#tableOrderMateriel tr.parentTr").eq(index).find(".hiddenMaterialPreLoss")[0].value = materialPreLoss;
	            <!-- 含损耗单耗 -->
	            var materialLoss;
	            <!-- 服装数量 -->
	            var indentQuantity = $("#tableOrderMateriel tr.parentTr").eq(index).find(".sub-quantity").text();
	            $("#tableOrderMateriel tr.parentTr").eq(index).find(".hiddenIndentQuantity")[0].value = indentQuantity;
	            <!-- 预订耗料数 -->
	            var planMaterialLoss;
	            if (materialCost=="" || materialCost==null || materialCost=="undefined"){
	            	materialCost=0;
	            }
	            if (materialPreLoss=="" || materialPreLoss==null || materialPreLoss=="undefined"){
	            	materialPreLoss=0;
	            }
	            if (indentQuantity=="" || indentQuantity==null || indentQuantity=="undefined"){
	            	indentQuantity=0;
	            }
	            materialLoss = Math.formatFloat(parseFloat(materialCost)*(parseFloat(materialPreLoss)/100+parseFloat(1)),2);
	            planMaterialLoss = Math.formatFloat(parseFloat(materialLoss)*parseFloat(indentQuantity),2);
	            $("#tableOrderMateriel tr.parentTr").eq(index).find(".cge-materialLoss").text(materialLoss);
	            $("#tableOrderMateriel tr.parentTr").eq(index).find(".hiddenMaterialLoss")[0].value = materialLoss;
	            $("#tableOrderMateriel tr.parentTr").eq(index).find(".cge-planMaterialLoss").text(planMaterialLoss);
	            $("#tableOrderMateriel tr.parentTr").eq(index).find(".hiddenPlanMaterialLoss")[0].value = planMaterialLoss;
	           
	        });
	        //全选  
	        inputObj.trigger("focus").trigger("select");
	   });
	        $("#tableOrderMateriel").find("td[class^='cge-']").on("click",function(){
		    	 //找到当前鼠标单击的td
		        var tdObj = $(this);
		        //保存原来的文本  
		        var oldText = $(this).text();
		        //创建一个文本框
		        var index = $(this).parent().index();
	            var cellIndex = $(this)[0].cellIndex;
		        var inputTemp = "";
		        if (cellIndex==4){
		        	inputTemp = "<input type='text' value = '"+$(this).text()+"' maxlength = '6'>";
		        } else {
		        	inputTemp = "<input type='text' value = '"+$(this).text()+"' maxlength = '12'>";
		        }
		        var inputObj = $(inputTemp);
		        
		        //去掉文本框的边框  
		        inputObj.css("border-width", 0);
		        inputObj.click(function () {
		            return false;
		        });
		        //使文本框的宽度和td的宽度相同  
		        inputObj.width(tdObj.width()-4);
		        inputObj.height(tdObj.height()-15);
		        //去掉文本框的外边距 
		        inputObj.css("margin", 0);
		        inputObj.css("padding", 0);
		        //把文本框放到td中  
		        tdObj.html(inputObj);
		        //文本框失去焦点的时候变为文本  
		        inputObj.blur(function () {
			           var strRegex = /^(-?\d+)(\.\d+)?$/;
			           if (!strRegex.test($(this).val())){
			        	   $(this).val('0')
			           }
		            var newText = $(this).val();
		            tdObj.html(newText);
		            <!-- 含损耗单耗 -->
		            var materialLoss = $("#tableOrderMateriel tr.parentTr").eq(index).find(".cge-materialLoss").text();
		            $("#tableOrderMateriel tr.parentTr").eq(index).find(".hiddenMaterialLoss")[0].value = materialLoss;
		            <!-- 预订耗料数 -->
		            var planMaterialLoss = $("#tableOrderMateriel tr.parentTr").eq(index).find(".cge-planMaterialLoss").text();
		            $("#tableOrderMateriel tr.parentTr").eq(index).find(".hiddenPlanMaterialLoss")[0].value = planMaterialLoss;
		        });
		      //全选  
		        inputObj.trigger("focus").trigger("select");
		   });
	}
	<!-- 供回调的面料使用  -->
	function onClickTdYY() {
	    $("#tableOrderMateriel").find("td[class^='subYY-']").on("click",function(){
	    	 //找到当前鼠标单击的td
	        var tdObj = $(this);
	        //保存原来的文本  
	        var oldText = $(this).text();
	        //创建一个文本框
	        var index = $(this).parent().index();
            var cellIndex = $(this)[0].cellIndex;
	        var inputTemp = "";
	        if (cellIndex==4){
	        	inputTemp = "<input type='text' value = '"+$(this).text()+"' maxlength = '6'>";
	        } else {
	        	inputTemp = "<input type='text' value = '"+$(this).text()+"' maxlength = '12'>";
	        }
	        var inputObj = $(inputTemp);
	        
	        //去掉文本框的边框  
	        inputObj.css("border-width", 0);
	        inputObj.click(function () {
	            return false;
	        });
	        //使文本框的宽度和td的宽度相同  
	        inputObj.width(tdObj.width()-4);
	        inputObj.height(tdObj.height()-15);
	        //去掉文本框的外边距 
	        inputObj.css("margin", 0);
	        inputObj.css("padding", 0);
	        //把文本框放到td中  
	        tdObj.html(inputObj);
	        //文本框失去焦点的时候变为文本  
	        inputObj.blur(function () {
		           var strRegex = /^(-?\d+)(\.\d+)?$/;
		           if (!strRegex.test($(this).val())){
		        	   $(this).val('0')
		           }
	            var newText = $(this).val();
	            tdObj.html(newText);
	            <!-- 单价 -->
	            var materialCost = $("#tableOrderMateriel tr.parentTr").eq(index).find(".subYY-materialCost").text();
	            $("#tableOrderMateriel tr.parentTr").eq(index).find(".hiddenMaterialCost")[0].value = materialCost;
	            <!-- 损耗 -->
	            var materialPreLoss = $("#tableOrderMateriel tr.parentTr").eq(index).find(".subYY-materialPreLoss").text();
	            $("#tableOrderMateriel tr.parentTr").eq(index).find(".hiddenMaterialPreLoss")[0].value = materialPreLoss;
	            <!-- 含损耗单耗 -->
	            var materialLoss;
	            <!-- 服装数量 -->
	            var indentQuantity = $("#tableOrderMateriel tr.parentTr").eq(index).find(".subYY-quantity").text();
	            $("#tableOrderMateriel tr.parentTr").eq(index).find(".hiddenIndentQuantity")[0].value = indentQuantity;
	            <!-- 预订耗料数 -->
	            var planMaterialLoss;
	            if (materialCost=="" || materialCost==null || materialCost=="undefined"){
	            	materialCost=0;
	            }
	            if (materialPreLoss=="" || materialPreLoss==null || materialPreLoss=="undefined"){
	            	materialPreLoss=0;
	            }
	            if (indentQuantity=="" || indentQuantity==null || indentQuantity=="undefined"){
	            	indentQuantity=0;
	            }
	            materialLoss = Math.formatFloat(parseFloat(materialCost)*(parseFloat(materialPreLoss)/100+parseFloat(1)),2);
	            planMaterialLoss = Math.formatFloat(parseFloat(materialLoss)*parseFloat(indentQuantity),2);
	            $("#tableOrderMateriel tr.parentTr").eq(index).find(".cgeYY-materialLoss").text(materialLoss);
	            $("#tableOrderMateriel tr.parentTr").eq(index).find(".hiddenMaterialLoss")[0].value = materialLoss;
	            $("#tableOrderMateriel tr.parentTr").eq(index).find(".cgeYY-planMaterialLoss").text(planMaterialLoss);
	            $("#tableOrderMateriel tr.parentTr").eq(index).find(".hiddenPlanMaterialLoss")[0].value = planMaterialLoss;
	           
	        });
	        //全选  
	        inputObj.trigger("focus").trigger("select");
	   });
	        $("#tableOrderMateriel").find("td[class^='cgeYY-']").on("click",function(){
		    	 //找到当前鼠标单击的td
		        var tdObj = $(this);
		        //保存原来的文本  
		        var oldText = $(this).text();
		        //创建一个文本框
		        var index = $(this).parent().index();
	            var cellIndex = $(this)[0].cellIndex;
		        var inputTemp = "";
		        if (cellIndex==4){
		        	inputTemp = "<input type='text' value = '"+$(this).text()+"' maxlength = '6'>";
		        } else {
		        	inputTemp = "<input type='text' value = '"+$(this).text()+"' maxlength = '12'>";
		        }
		        var inputObj = $(inputTemp);
		        
		        //去掉文本框的边框  
		        inputObj.css("border-width", 0);
		        inputObj.click(function () {
		            return false;
		        });
		        //使文本框的宽度和td的宽度相同  
		        inputObj.width(tdObj.width()-4);
		        inputObj.height(tdObj.height()-15);
		        //去掉文本框的外边距 
		        inputObj.css("margin", 0);
		        inputObj.css("padding", 0);
		        //把文本框放到td中  
		        tdObj.html(inputObj);
		        //文本框失去焦点的时候变为文本  
		        inputObj.blur(function () {
			           var strRegex = /^(-?\d+)(\.\d+)?$/;
			           if (!strRegex.test($(this).val())){
			        	   $(this).val('0')
			           }
		            var newText = $(this).val();
		            tdObj.html(newText);
		            <!-- 含损耗单耗 -->
		            var materialLoss = $("#tableOrderMateriel tr.parentTr").eq(index).find(".cgeYY-materialLoss").text();
		            $("#tableOrderMateriel tr.parentTr").eq(index).find(".hiddenMaterialLoss")[0].value = materialLoss;
		            <!-- 预订耗料数 -->
		            var planMaterialLoss = $("#tableOrderMateriel tr.parentTr").eq(index).find(".cgeYY-planMaterialLoss").text();
		            $("#tableOrderMateriel tr.parentTr").eq(index).find(".hiddenPlanMaterialLoss")[0].value = planMaterialLoss;
		        });
		      //全选  
		        inputObj.trigger("focus").trigger("select");
		   });
	}
	<!-- 弹出核料明细画面  -->
	function popupDetailWin(obj,materialId){
		var $tr = obj.parentNode.parentNode;
		var index = $tr.rowIndex;
		popup('800px','519px','${ctx}/customization/nuclearmaterial/detail?index='+index+'&materialId='+materialId);
	}
	
	<!-- 设置下标  -->
	var tempIndex;
    function setIndex(){
        var reg=/tempIndex/g;
		var trObj = $("#tableOrderMateriel tr.parentTr").length;
		if (trObj >= 1) {
			for (var i = 0; i < trObj; i++) {
                    var tableFit = $("#tableOrderMateriel tr.parentTr").eq(i);
					$(tableFit).html($(tableFit).html().replace(reg,i));
			}
		}
	}
    </script>
</head>
<body>
<form id="inputForm" method="post" >
<input type="hidden" id="id" name="id" value="${orderMateriel.id}"/>
<input type="hidden" id="version" name="version" value="${orderMateriel.version}"/>
<input type="hidden" id="reserveMeterialStatus" name="reserveMeterialStatus" value="${orderMateriel.reserveMeterialStatus}"/>
<div class="layerHeader clearfix">
	<c:if test="${orderMateriel.id==null || orderMateriel.id==''}">
		<p class="headerTitle"><spring:message code="orderMateriel_create_head" /></p>
	</c:if>
	<c:if test="${orderMateriel.id!=null && orderMateriel.id!=''}">
		<p class="headerTitle"><spring:message code="orderMateriel_edit_head" /></p>
	</c:if>
    <div class="headerButton clearfix">
        <shiro:hasPermission name="customization:nuclearmaterial:edit">
        <button type="button" id="selMatBtn" onclick="selectMhangeMaterialLis();"><spring:message code="orderMateriel_create_btn_material" /></button>
        <button type="button" id="confirmBtn" onclick="saveForm.save(this)"><spring:message code="btn_ok" /></button>
        </shiro:hasPermission>
        <button type="button" onclick="closeWin()"><spring:message code="btn_cancle" /></button>
    </div>
</div>
<div class="tabBox">
    <ul class="clearfix">
     	<li class="active"><spring:message code="orderMateriel_show_tab_info" /></li>
        <li><spring:message code="orderMateriel_show_tab_material" /></li>
    </ul>
</div>
<div class="tabBoxSm" id="orderMaterierInfo">
<!-- 合同订单id -->
<input type ="hidden" id="indentId" name ="indentId" value="${orderMateriel.indentId}"/>
<!-- 款式id -->
<input type ="hidden" id="styleId" name ="styleId" value="${orderMateriel.styleId}"/>
<!-- 款号 -->
<input type ="hidden" id=styleNo name ="styleNo" value="${orderMateriel.styleNo}"/>
<!-- 大货单耗id -->
<input type ="hidden" id="unitCostId" name ="unitCostId" value="${orderMateriel.unitCostId}"/>
<!-- 合同id -->
<input type ="hidden" id="contractId" name ="contractId" value="${orderMateriel.contractId}"/>
<!-- 合同编号 -->
<input type ="hidden" id="contractNo" name ="contractNo" value="${orderMateriel.contractNo}"/>
    <div class="tabSm smOrderBox">
        <div class="items clearfix">
            <!-- 合同单号(核料信息) -->
            <div class="col-33 clearfix haveToBox">
                <p class="tit"><spring:message code="orderMateriel_show_indentNo" /></p>
                <input type="text" id="indentNo"  name="indentNo" value="${orderMateriel.indentNo}" readonly data-rule-required="true" data-msg-required="<spring:message code="orderMateriel_create_indent_err_msg"/>">
                <c:if test="${orderMateriel.id==null || orderMateriel.id==''}">
                <button type="button" onclick="popup('800px','519px','${ctx}/customization/nuclearmaterial/indentSelect')">
					<spring:message code="style_selectOK" />
				</button>
				</c:if>
                <p class="haveTo">*</p>
            </div>
            <!-- 客户(核料信息) -->
            <div class="col-33 clearfix">
                <p class="tit"><spring:message code="orderMateriel_show_ognizationName" /></p>
                <input type="text" id="ognizationName"  name="ognizationName" value="${orderMateriel.ognizationName}" readonly>
            </div>
            <!-- 签订日期(核料信息) -->
            <div class="col-33 clearfix">
                <p class="tit"><spring:message code="orderMateriel_show_indentIssueDate" /></p>
                <input type="text" id="indentIssueDate"  name="indentIssueDate" value="<fmt:formatDate value="${orderMateriel.indentIssueDate}" pattern="yyyy-MM-dd" />" readonly>
            </div>
        </div>
        <div class="items clearfix">
            <!-- 款号(核料信息) -->
            <div class="col-33 clearfix haveToBox">
                <p class="tit"><spring:message code="orderMateriel_show_styleCustomerNo" /></p>
                <input type="text" id="styleCustomerNo"  name="styleCustomerNo" value="${orderMateriel.styleCustomerNo}" readonly readonly data-rule-required="true" data-msg-required="<spring:message code="orderMateriel_create_style_err_msg"/>">
                <p class="haveTo">*</p>
            </div>
            <!-- 款式名称(核料信息) -->
            <div class="col-33 clearfix">
                <p class="tit"><spring:message code="orderMateriel_show_styleNameCn" /></p>
                <input type="text" id="styleNameCn"  name="styleNameCn" value="${orderMateriel.styleNameCn}" readonly>
            </div>
            <!-- 交货日期(核料信息) -->
            <div class="col-33 clearfix">
                <p class="tit"><spring:message code="orderMateriel_show_indentDeliveryDate" /></p>
                <input type="text" id="indentDeliveryDate"  name="indentDeliveryDate" value="<fmt:formatDate value="${orderMateriel.indentDeliveryDate}" pattern="yyyy-MM-dd" />" readonly>
            </div>
        </div>
        <div class="items clearfix">
            <!-- 订单数量(核料信息) -->
            <div class="col-33 clearfix">
                <p class="tit"><spring:message code="orderMateriel_show_indentQuantity" /></p>
                <input type="tel" value="<fmt:formatNumber value="${orderMateriel.indentQuantity}" pattern="#,##0.#####"/>" readonly>
                <input type="hidden" id="indentQuantity"  name="indentQuantity" value="<fmt:formatNumber value="${orderMateriel.indentQuantity}" pattern="0.#####"/>"/>
            </div>
        </div>
        <div class="items clearfix">
            <!-- 单耗号(核料信息) -->
            <div class="col-33 clearfix haveToBox">
                <p class="tit"><spring:message code="orderMateriel_show_unitCostNo" /></p>
                <select style="width:52%" id="unitCostNo" name="unitCostNo" onChange="unitCostFun('unitCostId')" data-rule-required="true" data-msg-required="<spring:message code="orderMateriel_create_unit_err_msg"/>">
                       <c:if test="${empty orderMateriel.unitCostList}" >
                       <option value=""></option>
                       </c:if>
                       <c:if test="${not empty orderMateriel.unitCostList}" >
                       <c:forEach items="${orderMateriel.unitCostList}" var="unitCostInfo">
                           <option data-value="${unitCostInfo.id}" <c:if test="${unitCostInfo.unitCostNo eq orderMateriel.unitCostNo}">selected="selected"</c:if> value="${unitCostInfo.unitCostNo}" >
                                 ${unitCostInfo.unitCostNo}
                           </option>
                       </c:forEach>
                       </c:if>                    
                </select>
                <p class="haveTo">*</p>
            </div>
            <!-- 单耗成本(核料信息) -->
            <div class="col-33 clearfix" id="divUnitCost">
                <p class="tit"><spring:message code="orderMateriel_show_unitCost" /></p>
                <input type="tel" id="unitCost"  name="unitCost" value="<fmt:formatNumber value="${orderMateriel.unitCost}" pattern="#,##0.00#"/>" readonly>
            </div>
            <!-- 物料数量(核料信息) -->
            <div class="col-33 clearfix" id="divMaterialNum">
                <p class="tit"><spring:message code="orderMateriel_show_materialNum" /></p>
                <input type="tel" id="materialNum"  name="materialNum" value="<fmt:formatNumber value="${orderMateriel.materialNum}" pattern="#,##0"/>" readonly>
            </div>
        </div>
	</div>
    <div class="tabSm none">
    	<div class="tableArea">
        	<div class="tableScroll tableScrollSm" id="marteriaList" style="overflow: auto;height: 500px;">
        		<table cellpadding="0" class="tableHead">
                    <thead>
                    <tr>
                    	<th class="tab-cz"><spring:message code="common_operating" /></th>
                        <th class="tab-wltp"><spring:message code="orderMateriel_show_material_materialFile" /></th>
                        <th class="tab-wlmcbj"><spring:message code="orderMateriel_show_material_materialNameCn" /></th>
                        <th class="tab-wllb" style="width: 70px;"><spring:message code="orderMateriel_show_material_materialTypeCd" /></th>
                        <th class="tab-wlys" style="width: 70px;"><spring:message code="orderMateriel_show_material_materialColor" /></th>
                        <th class="tab-fk" style="width: 70px;"><spring:message code="orderMateriel_show_material_materialSpec" /></th>
                        <th class="tab-dw"><spring:message code="orderMateriel_show_material_materialUnitCd" /></th>
                        <th class="tab-dh"><spring:message code="orderMateriel_show_material_materialCost" /></th>
                        <th class="tab-sh"><spring:message code="orderMateriel_show_material_materialPreLoss" /></th>
                        <th class="tab-sh"><spring:message code="orderMateriel_show_material_materialLoss" /></th>
                        <th class="tab-wltp"><spring:message code="orderMateriel_show_material_indentQuantity" /></th>
                        <th class="tab-sh"><spring:message code="orderMateriel_show_material_planMaterialLoss" /></th>
                        <th class="tab-wltp"><spring:message code="orderMateriel_show_material_purchaseReserveQuantity" /></th>
                        <th class="tab-wltp"><spring:message code="orderMateriel_show_material_orderMaterielDetail" /></th>
                    </tr>
                    </thead>
                </table>
                <table cellpadding="0" class="tableBody" id="tableOrderMateriel">
                    <tbody id="changeMaterialBody">
                	<c:if test="${not empty orderMateriel.orderMaterielList}" >
                    <c:forEach items="${orderMateriel.orderMaterielList}" var="orderMate" varStatus="status">
                    <tr class="parentTr">
                    	<td class="tab-cz" onclick="removeFun(this)"><img src="${ctxStatic}/images/del_icon.png" class="delBtn"></td>
                        <!-- 物料图片(面辅配料) -->
                        <td class="materialFile tab-wltp">
                           <c:if test="${not empty orderMate.materialFile}">
                                 <img src="${orderMate.materialFile}" class="wltp">
                           </c:if>
                           <c:if test="${empty orderMate.materialFile}">
                                 <img src="${ctxStatic}/images/pic-none.jpg" class="wltp">
                           </c:if>
                        </td>
                        <!-- 编码(面辅配料)/物料名称 -->
                        <td class="tab-wlmcbj">${orderMate.materialCode}<c:if test="${orderMate.materialNameCn != '' }"><br>${orderMate.materialNameCn}</c:if></td>
                        <!-- 物料类别(面辅配料) -->
                        <td class="tab-wllb" style="width: 70px;">${fns:getDictName(orderMate.materialTypeCd)}</td>
                        <!-- 物料颜色(面辅配料) -->
                        <td class="materialColor tab-wlys" style="width: 70px;">${orderMate.materialColor}</td>
                        <!-- 幅宽(面辅配料) -->
                        <td class="materialSpec tab-fk" style="width: 70px;">${orderMate.materialSpec}</td>
                        <!-- 单位(面辅配料) -->
                        <td class="tab-dw">${fns:getDictName(orderMate.materialUnitCd)}</td>
                        <!-- 单耗(面辅配料) -->
                        <td class="sub-materialCost tab-dh"><fmt:formatNumber value="${orderMate.materialCost}" pattern="#,##0.00##"/></td>
                        <!-- 损耗（%）(面辅配料) -->
                        <td class="sub-materialPreLoss tab-sh"><c:if test="${not empty orderMate.materialPreLoss}"><fmt:formatNumber value="${orderMate.materialPreLoss}" pattern="#,##0.00#"/></c:if></td>
                        <!-- 含损耗单耗(面辅配料) -->
                        <td class="cge-materialLoss tab-sh"><fmt:formatNumber value="${orderMate.materialLoss}" pattern="#,##0.00##"/></td>
                        <!-- 服装数量(面辅配料) -->
                        <td class="sub-quantity tab-wltp"><fmt:formatNumber value="${orderMate.indentQuantity}" pattern="#,##0.00###"/></td>
                        <!-- 预订耗料数(面辅配料) -->
                        <td class="cge-planMaterialLoss tab-sh"><fmt:formatNumber value="${orderMate.planMaterialLoss}" pattern="#,##0.00#"/></td>
                        <!-- 采购数量(面辅配料) -->
                        <td class="sumInput tab-wltp"><fmt:formatNumber value="${orderMate.purchaseReserveQuantity}" pattern="#,##0.00##"/></td>
                        <!-- 核料明细(面辅配料) -->
                        <td class="showDetails tab-wltp">
                        <c:if test="${orderMate.orderMaterielDetail eq 0}">
                            <p class="linkBox" onclick="popupDetailWin(this,${orderMate.materialId});"><spring:message code="orderMateriel_show_material_MaterielDetailNone" /></p>
                        </c:if>
                        <c:if test="${orderMate.orderMaterielDetail != 0}">
                            <p class="linkBox" onclick="popupDetailWin(this,${orderMate.materialId});"><spring:message code="orderMateriel_show_material_MaterielDetailExist" /></p>
                        </c:if>
                        </td>
                        <td class="materialCode none">${orderMate.materialCode}</td>
                        <td class="materialNameCn none">${orderMate.materialNameCn}</td>
                        <td class="materialComposition none">${orderMate.materialComposition}</td>
                        <!-- 库存数量 -->
                        <td class="materialQuantity none">${orderMate.materialQuantity}</td>
                        <input type="hidden" name="orderMaterielList[tempIndex].materialId" value="${orderMate.materialId}"/>
                        <input type="hidden" class="hiddenOrderMaterNum" name="orderMaterielList[tempIndex].purchaseReserveQuantity" value="<fmt:formatNumber value="${orderMate.purchaseReserveQuantity}" pattern="0.00##"/>">
                        <input type="hidden" class="hiddenMaterialCost" name="orderMaterielList[tempIndex].materialCost" value="<fmt:formatNumber value="${orderMate.materialCost}" pattern="0.00##"/>"/>
                        <input type="hidden" class="hiddenMaterialPreLoss" name="orderMaterielList[tempIndex].materialPreLoss" value="<fmt:formatNumber value="${orderMate.materialPreLoss}" pattern="0.00##"/>"/>
                        <input type="hidden" class="hiddenMaterialLoss" name="orderMaterielList[tempIndex].materialLoss" value="<fmt:formatNumber value="${orderMate.materialLoss}" pattern="0.00##"/>"/>
                        <input type="hidden" class="hiddenIndentQuantity" name="orderMaterielList[tempIndex].indentQuantity" value="<fmt:formatNumber value="${orderMate.indentQuantity}" pattern="0.00##"/>"/>
                        <input type="hidden" class="hiddenPlanMaterialLoss" name="orderMaterielList[tempIndex].planMaterialLoss" value="<fmt:formatNumber value="${orderMate.planMaterialLoss}" pattern="0.00##"/>"/>
                        <td class="addRow none">
                        <table  cellpadding="0" class="tableBody">
                          <tbody>
                            <tr>
							    <td style="width:50px"><img src="${ctxStatic}/images/del_icon.png" class="delBtn" onclick='removeVender(this)'></td>
				                <td class="selectVenderId" style="width:155px">
				                   <select name="venderId" style="width:155px" onchange="selectChange(this);">
                                       <c:forEach items="${orderMate.selectVenderList}" var="vender">
                                       <option value="${vender.venderId}"> 
                                          ${vender.venderNameCn}
                                       </option>
                                       </c:forEach>
                                   </select>
				                </td>
				                <td style="width:95px" class="sub-PurchaseReserveQuantity"><fmt:formatNumber value="0" pattern="##0.00##"/></td>
				                <td style="width:95px" class="sub-PurchaseUnitPrice"><fmt:formatNumber value="0" pattern="##0.00###"/></td>
				                <td style="width:95px" class="sub-PurchaseTaxRebate"><fmt:formatNumber value="0" pattern="##0.00#"/></td>
				                <td style="width:95px" class="PurchaseUnitCost"><fmt:formatNumber value="0" pattern="##0.00###"/></td>
				                <td style="width:95px" class="PurchasePrice"><fmt:formatNumber value="0" pattern="##0.00###"/></td>
				                <input type="hidden" class="subHiddenVenderId" name="venderIdtemp" value="${orderMate.selectVenderList[0].venderId}"/>
				                <input type="hidden" class="subHiddenPurchaseReserveQuantity" name="purchaseReserveQuantitytemp" value=""/>
				                <input type="hidden" class="subHiddenPurchaseUnitPrice" name="purchaseUnitPricetemp" value=""/>
				                <input type="hidden" class="subHiddenPurchaseTaxRebate" name="purchaseTaxRebatetemp" value=""/>
	                       </tr>
	                       </tbody>
	                    </table>
                        </td>
                        <td class = "addTable none">
                        <table  cellpadding="0" class="tableBody">
                          <tbody>
                          <c:forEach items="${orderMate.venderForm.materialPurchaseList}" var="materialPurchase" varStatus="purchaseStatus">
                             <tr>
							    <td style="width:50px"><img src="${ctxStatic}/images/del_icon.png" class="delBtn" onclick='removeVender(this)'></td>
				                <td style="width:155px">
				                   <select name="venderId" style="width:155px" onchange="selectChange(this);">
                                       <c:forEach items="${orderMate.selectVenderList}" var="vender">
                                       <option <c:if test="${vender.venderId eq materialPurchase.venderId}">selected="selected"</c:if> value="${vender.venderId}" >
                                          ${vender.venderNameCn}
                                       </option>
                                       </c:forEach>
                                   </select>
				                </td>
				                <td style="width:95px" class="sub-PurchaseReserveQuantity"><fmt:formatNumber value="${materialPurchase.purchaseReserveQuantity}" pattern="##0.00##"/></td>
				                <td style="width:95px" class="sub-PurchaseUnitPrice"><fmt:formatNumber value="${materialPurchase.purchaseUnitPrice}" pattern="##0.00##"/></td>
				                <td style="width:95px" class="sub-PurchaseTaxRebate"><fmt:formatNumber value="${materialPurchase.purchaseTaxRebate}" pattern="##0.00#"/></td>
				                <td style="width:95px" class="PurchaseUnitCost"><fmt:formatNumber value="${materialPurchase.purchaseUnitCost}" pattern="##0.00###"/></td>
				                <td style="width:95px" class="PurchasePrice"><fmt:formatNumber value="${materialPurchase.purchasePrice}" pattern="##0.00###"/></td>
				                <input type="hidden" class="subHiddenVenderId" name="orderMaterielList[tempIndex].venderForm.materialPurchaseList[${purchaseStatus.index}].venderId" value="${materialPurchase.venderId}"/>
				                <input type="hidden" class="subHiddenPurchaseReserveQuantity" name="orderMaterielList[tempIndex].venderForm.materialPurchaseList[${purchaseStatus.index}].purchaseReserveQuantity" value="${materialPurchase.purchaseReserveQuantity}"/>
				                <input type="hidden" class="subHiddenPurchaseUnitPrice" name="orderMaterielList[tempIndex].venderForm.materialPurchaseList[${purchaseStatus.index}].purchaseUnitPrice" value="${materialPurchase.purchaseUnitPrice}"/>
				                <input type="hidden" class="subHiddenPurchaseTaxRebate" name="orderMaterielList[tempIndex].venderForm.materialPurchaseList[${purchaseStatus.index}].purchaseTaxRebate" value="${materialPurchase.purchaseTaxRebate}"/>
	                       </tr>
	                       </c:forEach>
                          </tbody>
                        </table>   
                        </td>
                        <td class = "totalRowNum none">0</td>
                    </tr>
                    </c:forEach>
	                </c:if>    
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
</form>
	<table id="hiddenTable" class="none">
		<tr class="parentTr">
			<td class="tab-cz" onclick="removeFun(this)"><img
				src="${ctxStatic}/images/del_icon.png" class="delBtn"></td>
			<!-- 物料图片(面辅配料) -->
			<td class="materialFile tab-wltp"></td>
			<!-- 编码(面辅配料)/物料名称 -->
			<td class="tab-wlmcbj"></td>
			<!-- 物料类别(面辅配料) -->
			<td class="tab-wllb" style="width: 70px;"></td>
			<!-- 物料颜色(面辅配料) -->
			<td class="materialColor tab-wlys" style="width: 70px;"></td>
			<!-- 幅宽(面辅配料) -->
			<td class="materialSpec tab-fk" style="width: 70px;"></td>
			<!-- 单位(面辅配料) -->
			<td class="tab-dw"></td>
			<!-- 单耗(面辅配料) -->
			<td class="subYY-materialCost tab-dh"><fmt:formatNumber value="0" pattern="##0.00#"/></td>
			<!-- 损耗（%）(面辅配料) -->
			<td class="subYY-materialPreLoss tab-sh"><fmt:formatNumber value="0" pattern="##0.00#"/></td>
			<!-- 含损耗单耗(面辅配料) -->
			<td class="cgeYY-materialLoss tab-sh"><fmt:formatNumber value="0" pattern="##0.00#"/></td>
			<!-- 服装数量(面辅配料) -->
			<td class="subYY-quantity tab-wltp"><fmt:formatNumber value="0" pattern="##0.00#"/></td>
			<!-- 预订耗料数(面辅配料) -->
			<td class="cgeYY-planMaterialLoss tab-sh"><fmt:formatNumber value="0" pattern="##0.00#"/></td>
			<!-- 采购数量(面辅配料) -->
			<td class="sumInput tab-wltp"><fmt:formatNumber value="0" pattern="##0.00#"/></td>
			<!-- 核料明细(面辅配料) -->
			<td class="showDetails tab-wltp"></td>
			<td class="materialCode none"></td>
			<td class="materialNameCn none"></td>
			<td class="materialComposition none"></td>
			<!-- 库存数量 -->
			<td class="materialQuantity none"></td>
			<td><input type="hidden" class="hiddenMaterialId" name="orderMaterielList[tempIndex].materialId" value=""/></td>
            <input type="hidden" class="hiddenOrderMaterNum" name="orderMaterielList[tempIndex].purchaseReserveQuantity" value="">
            <input type="hidden" class="hiddenMaterialCost" name="orderMaterielList[tempIndex].materialCost" value=""/>
            <input type="hidden" class="hiddenMaterialPreLoss" name="orderMaterielList[tempIndex].materialPreLoss" value=""/>
            <input type="hidden" class="hiddenMaterialLoss" name="orderMaterielList[tempIndex].materialLoss" value=""/>
            <input type="hidden" class="hiddenIndentQuantity" name="orderMaterielList[tempIndex].indentQuantity" value=""/>
            <input type="hidden" class="hiddenPlanMaterialLoss" name="orderMaterielList[tempIndex].planMaterialLoss" value=""/>
			<td class="addRow none">
				<table cellpadding="0" class="tableBody">
					<tbody>
						<tr>
							<td style="width: 50px"><img
								src="${ctxStatic}/images/del_icon.png" class="delBtn"
								onclick='removeVender(this)'></td>
							<td class="selectVenderId" style="width: 155px"><select
								name="venderId" style="width: 155px"
								onchange="selectChange(this);">
									<c:forEach items="${venderList}" var="vender">
										<option value="${vender.venderId}">
											${vender.venderNameCn}</option>
									</c:forEach>
							</select></td>
							<td style="width: 95px" class="sub-PurchaseReserveQuantity"><fmt:formatNumber value="0" pattern="##0.00##" /></td>
							<td style="width: 95px" class="sub-PurchaseUnitPrice"><fmt:formatNumber value="0" pattern="##0.00##" /></td>
							<td style="width: 95px" class="sub-PurchaseTaxRebate"><fmt:formatNumber value="0" pattern="##0.00#" /></td>
							<td style="width: 95px" class="PurchaseUnitCost"><fmt:formatNumber value="0" pattern="##0.00###" /></td>
							<td style="width: 95px" class="PurchasePrice"><fmt:formatNumber value="0" pattern="##0.00##" /></td>
							<input type="hidden" class="subHiddenVenderId"
								name="venderIdtemp"
								value="${venderList[0].venderId }" />
							<input type="hidden" class="subHiddenPurchaseReserveQuantity"
								name="purchaseReserveQuantitytemp" value="" />
							<input type="hidden" class="subHiddenPurchaseUnitPrice"
								name="purchaseUnitPricetemp" value="" />
							<input type="hidden" class="subHiddenPurchaseTaxRebate"
								name="purchaseTaxRebatetemp" value="" />
						</tr>
					</tbody>
				</table>
			</td>
			<td class="addTable none">
				<table  cellpadding="0" class="tableBody">
		            <tbody>
		            </tbody>
	            </table>
			</td>
			<td class="totalRowNum none">0</td>
		</tr>
	</table>
</body>
</html>